
<template>
  <button class="buttonDownload" @click="downloadFile">Download</button>
</template>


<script setup lang="ts">

const downloadFile = async () => {
  const link = document.createElement('a');
  link.href = '/files/k8s迁移方案.pdf';
  link.download = 'k8s迁移方案';
  link.click();
}

</script>


<style scoped lang="scss">
.buttonDownload {
  display: inline-block;
  position: relative;
  padding: 10px 20px;
  background-color: var(--scheme-moss-700);
  color: white;
  text-decoration: none;
  font-size: 0.3em;
  text-align: center;
  text-indent: 15px;
  font-family: 'Microsoft JhengHei', sans-serif;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.116);
  margin: 10px 0;
}

.buttonDownload:hover {
  color: var(--color-text);
}

.buttonDownload path  {
  fill: rgb(19, 19, 19);
}

.buttonDownload:before, .buttonDownload:after {
  content: ' ';
  display: block;
  position: absolute;
  left: 15px;
  top: 52%;
}

.buttonDownload:before {
  width: 10px;
  height: 2px;
  border-style: solid;
  border-width: 0 2px 2px;
}

.buttonDownload:after {
  width: 0;
  height: 0;
  margin-left: 3px;
  margin-top: -7px;
  border-style: solid;
  border-width: 4px 4px 0 4px;
  border-color: transparent;
  border-top-color: inherit;
  animation: downloadArrow 1s linear infinite;
  animation-play-state: paused;
}

.buttonDownload:hover:before {
  border-color: #cdefbd;
}

.buttonDownload:hover:after {
  border-top-color: #cdefbd;
  animation-play-state: running;
}

@keyframes downloadArrow {
  0% {
    margin-top: -7px;
    opacity: 1;
  }

  0.001% {
    margin-top: -15px;
    opacity: 0.4;
  }

  50% {
    opacity: 1;
  }

  100% {
    margin-top: 0;
    opacity: 0.4;
  }
}

@media screen and (max-width: 520px) {
  .buttonDownload {
    left: 190px;
  }
}

</style>